Imports System.Windows.Forms

Public Class BusyDialog
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value = 100 Then
            ProgressBar1.Value = 0
        Else
            ProgressBar1.Value += 1
        End If

        If ProgressBar1.Value Mod 30 = 0 Then
            Me.Text = "MetaView is busy"
        End If
        If ProgressBar1.Value Mod 30 = 14 Then
            Me.Text = "MetaView is busy."
        End If
        If ProgressBar1.Value Mod 30 = 29 Then
            Me.Text = "MetaView is busy.."
        End If
    End Sub

    Private Sub BusyDialog_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

    End Sub

    Private Sub BusyDialog_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress

    End Sub

    Private Sub BusyDialog_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        
    End Sub

    Private Sub BusyDialog_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Timer1.Enabled = True
        ProgressBar1.Value = 0
    End Sub

    Private Sub BusyDialog_Move(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Move
        Me.Location = New Point(Convert.ToInt16((Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 2), Convert.ToInt16((Screen.PrimaryScreen.WorkingArea.Height - Me.Height) / 2))
    End Sub

    Private Sub BusyDialog_PreviewKeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown
        If (e.Alt) Then
            If e.KeyCode = Keys.F4 Then
                MessageBox.Show("This form cannot be closed.")
            End If
        End If
    End Sub
End Class
